<div class="home-index-middle">
	<div class="w1224">
		<div class="g-crumbs"></div>
		<div class="home-main">
<style>
.menu_check{
	color:#1657C2  !important
}
</style>
			<div class="le-menu fl">
				<div class="menu-ul">
					<ul>
						<li class="ma"></i>个人中心</li>
						<li><a  href="<?=base_url()?>index.php/home/userinfo/userinfo/index">个人信息</a></li>
						<li><a class ="menu_check" href="<?=base_url()?>index.php/home/userinfo/userinfo/safetysetting">安全设置</a></li>
					</ul>
					<ul>
						<li class="ma">订单中心</li>
						<li><a  href="<?=base_url()?>index.php/home/userinfo/orderinfo/index">我的订单</a></li>
						<li><a  href="/Home-Order-comment.html">我的评价</a></li>
					</ul>
					<ul>
						<li class="ma"></i>客户服务</li>
						<li><a  href="/Home-Order-dispute.html">订单投诉</a></li>
						<li><a  href="/Home-Order-expose_list.html">违规举报</a></li>
					</ul>
				</div>
			</div>
			<?php if($type=="show"):?>
	    	<div class="ri-menu fr">
	    		<div class="menumain">
	                <div class="user_nav_top">
	                    <ul>
	                        <li>
	                            安全设置
	                        </li>
	                    </ul>
	                </div>
		    		<div class="menu-ri-t setsafe p">
		    			<div class="mu-head fl">
		    				账户安全等级：
		    			</div>
		    			<div class="mu-midd fl">
	                        <em>低</em><span class="range"></span><span class="range1"></span>
	                        <em>中</em><span class="range"></span><span class="range2"></span>			
	                    </div>
	                    <p class="advice">建议你启动全部安全设置，以保障账户及资金安全</p>
		    		</div>
		    		<div class="safe_list_set">
	                    <ul>
	                    <li><span class="sx1">登录密码</span><span class="sx2 setED"><i class="li_point bg54bg29"></i>已设置</span></li>
	                    <li class="sx3">互联网账号存在被盗风险，建议您定期更改密码以及保护账户安全。</li>
	                    <li><a class="handle" href="<?=base_url()?>index.php/home/userinfo/userinfo/safetysetting?type=changePassword">修改</a></li>
	                    </ul>
	                    <ul>
	                        <li><span class="sx1">手机验证</span><span class="sx2 setED"><i class="li_point bg54bg29"></i>已绑定</span></li>
	                        <li class="sx3">您验证的手机：<em><?php echo $_SESSION['user_name']?></em>若已丢失或停用，请立即更换，避免账户被盗。</li>
	                        <li><a class="handle" href="/Home-User-mobile_validate-type-mobile-step-1.html">绑定</a></li>
	                    </ul>
	                    <ul>
	                    <li><span class="sx1">邮箱验证</span><span class="sx2 noSET"><i class="li_point bg999999"></i>未绑定</span></li>
	                    <li class="sx3">您没有绑定邮箱。互联网账号存在被盗风险，建议您立即绑定一保护账户安全。</li>
	                    <li><a class="handle" href="/Home-User-email_validate-type-email-step-1.html">绑定</a></li>
	                </ul>
		    		</div>
	    		</div>
	    	</div>
	   		<?php elseif($type == "changePassword"):?>
	    	<div class="ri-menu fr">
                <div class="menumain">
                    <div class="user_nav_top">
                        <ul>
                            <li>
                                安全设置
                            </li>
                        </ul>
                    </div>
                    <div class="thirset">
                        <div class="forget_step">
                            <span class="forgeted" >1</span>
                                       
                            <li class="forget_info2 infoed" >设置新密码</li>
                            </ul>
                        </div>
                    </div>
                    <div class="personerinfro verifyi step1">
                        <form action="" method="post">
                            <ul class="name_jz ">
                                <li class="infor_wi_le"><a href="javascript:void(0);">原密码：</a></li>
                                <li>
                                	<a href="javascript:void(0);">
                                		<input class="f_input w158" type="text" name="oldPass" id="oldPass" value=""
                                               placeholder="请输入原密码">
                                    </a>
                                </li>
                            </ul>
                            <ul class="name_jz ">
                                <li class="infor_wi_le"><a href="javascript:void(0);">新密码：</a></li>
                                <li>
                                	<a href="javascript:void(0);">
                                		<input class="f_input w158" type="text" name="newPass" id="newPass" value=""
                                               placeholder="请输入新密码">
                                    </a>
                                </li>
                            </ul>
                            <ul class="name_jz ">
                                <li class="infor_wi_le"><a href="javascript:void(0);">确认新密码：</a></li>
                                <li>
                                	<a href="javascript:void(0);">
                                		<input class="f_input w158" type="text" name="renewPass" id="renewPass" value=""
                                               placeholder="二次确认新密码">
                                    </a>
                                </li>
                            </ul>
                            <ul class="hobby_jz">
                                <li class="infor_wi_le"></li>
                                <div class="save_s">
                                    <input class="saveN" type="button" id="" onclick="makeSure();" name=""
                                           value="确认修改">
                                </div>
                            </ul>
                        </form>
                    </div>
                </div>
            </div>
        	<?php elseif($type == "changeEmail"):?>
        	<div class="ri-menu fr">
                <div class="menumain">
                    <div class="user_nav_top">
                        <ul>
                            <li>
                                安全设置
                            </li>
                        </ul>
                    </div>
                    <div class="thirset">
                        <div class="forget_step">
                            <span class="forgeted">1</span>
                            <i class="forgeting" ></i>
                            <span class="forgeting" >2</span>
                            <i class="forgeting" ></i>
                            <span class="forgeting" >3</span>
                            <ul class="forget_info">
                                <li class="forget_info2 infoed">验证身份</li>
                                <li class="forget_info3 infoing" >设置新密码</li>
                                <li class="forget_info4 infoing" >完成</li>
                            </ul>
                        </div>
                    </div>
                    <div class="personerinfro verifyi step1">
                        <form action="" method="post">
                            <ul class="birth_jz">
                                <li class="infor_wi_le"><a href="javascript:void(0);">验证身份方式：</a></li>
                                <li>
                                    <select name="sender" id="sender" onchange="checkSender(this)">
                                        <option value="phone" rel="13021126922">已验证手机</option>
                                        <option value="email" rel="">已验证邮箱</option>
                                    </select>
                                    <div class="f_ud"></div>
                                </li>
                            </ul>
                            <ul class="name_jz ">
                                <li class="infor_wi_le"><a href="javascript:void(0);">账户名称：</a></li>
                                <li><a href="javascript:void(0);">13021126922</a></li>
                            </ul>
                            <ul class="name_jz phone sender_name">
                                <li class="infor_wi_le"><a href="javascript:void(0);">已验证手机：</a></li>
                                <li><a href="javascript:void(0);" class="sender">13021126922</a></li>
                                <li class="f_rem">如无法使用，请联系客服</li>
                            </ul>
                            <ul class="name_jz email sender_name" hidden>
                                <li class="infor_wi_le"><a href="javascript:void(0);">已验证邮箱：</a></li>
                                <li><a href="javascript:void(0);" class="sender"></a></li>
                                <li class="f_rem">如无法使用，请联系客服</li>
                            </ul>
                            <ul class="name_jz checode">
                                <li class="infor_wi_le"><a href="javascript:void(0);">验证码：</a></li>
                                <li class="teaeu">
                                    <a href="javascript:void(0);">
                                        <input class="f_input w158" type="text" name="tpcode" id="tpcode" value=""
                                               placeholder="请输入验证码">
                                    </a>
                                    <a href="javascript:void(0);">
                                        <input class="button_yzm" type="button" name="" onclick="sendcode(this)"
                                               value="获取验证码"/>
                                    </a>
                                </li>
                            </ul>
                            <ul class="hobby_jz">
                                <li class="infor_wi_le"></li>
                                <div class="save_s">
                                    <input class="saveN" type="button" id="" onclick="nextstep()" name=""
                                           value="下一步">
                                </div>
                            </ul>
                        </form>
                    </div>
                </div>
            </div>
        	<?php endif;?>
	    </div>
	</div>
</div>
<script>
	function makeSure(){
		var repass = $("#renewPass").val();
		var pass = $("#newPass").val();
		var oldpassword = $("#oldPass").val();

		if(oldpassword.replace(/(^s*)|(s*$)/g, "").length ==0){
			alert("原密码输入为空");die();
		}

		if(pass.replace(/(^s*)|(s*$)/g, "").length ==0){
			alert("新密码输入为空");die();
		}

		if(repass.replace(/(^s*)|(s*$)/g, "").length ==0){
			alert("二次密码输入为空");die();
		}

		if(pass != repass){
			alert("两次密码输入不一致");die();
		}

		$.ajax({
            type: "POST",
            url: "changePassword",
            dataType: "json",
            data: {password:pass,oldpassword:oldpassword},
            success: function (data) {
                if(data.code != 1){
                    layer.alert(data.desc, {icon: 2, time: 10000});
                } else {
                    layer.alert(data.desc, {icon: 2, time: 10000});
                    //window.location.reload();
                    window.location.href = "../../login/login/logout";
                }
            }
        });
	}
</script>
		<!--footer-s-->
		<!--footer-s-->